#ifndef TERRAINROWSBIN
#define TERRAINROWSBIN

#include <surface\coonsSurface.h>
#include <surface\pointsBin.h>

#include <base\vec2i.h>
#include <base\vec2d.h>
#include <base\vec3d.h>

#include <Poco\Path.h>
#include <Poco\File.h>

#include <vector>
#include <queue>
#include <map>

using namespace std;

class fileTerrainModule;

class terrainRowsBin {

  int rows_count;
  int row_length;

  vec3d **rows;
  queue<int> foo;

  bool initial_state;
  coonsSurface surface;
  vector<vector<vec3d> *> interpolated_data;

  // row, col, pointbin
  map<int, map<int, pointsBin *> >           pbins;
  map<int, map<int, pointsBin *> >::iterator iri_iter;
  map<int, pointsBin *>::iterator            iir_iter;

  Poco::Path dir;
  Poco::Path textures_dir;
  fileTerrainModule *terrain_module;

private:

  terrainRowsBin();

  void interpolate();

public:

  void insertPoint(int row_index, int index_in_row, vec3d point);

  terrainRowsBin(int rows_count_, int row_length_, Poco::Path dir_, fileTerrainModule *terrain_module_);
  ~terrainRowsBin();
};

#endif